//创建一个路由器，暴露出去
import { createRouter, createWebHistory } from 'vue-router'
import Home from '../components/Home.vue'
import Page from '../components/Page.vue'


const router = createRouter({
    history: createWebHistory(),
    routes: [
        {
            path: '/',
            name: 'home',
            component: Home
        },
        {
            path: '/article/:id',
            name: 'article',
            component: Page,
            props: true // 允许将路由参数作为props传递给组件
        }
    ],
})

export default router